import {View, StyleSheet, TouchableOpacity} from 'react-native';

export default function TouchableOpacityDemo() {
  return (
    <View style={styles.container}>
      <TouchableOpacity
        style={styles.touch}
        activeOpacity={0.2}
        onPress={() => {
          console.log('press');
        }}
        delayLongPress={2000} //指定长按时间
        onLongPress={() => {
          console.log('longPress');
        }}
        onPressIn={() => {
          console.log('pressIn');
        }}
        onPressOut={() => {
          console.log('pressOut');
        }}
      />
    </View>
  );
}
const styles = StyleSheet.create({
  container: {
    width: '100%',
    height: '100%',
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
  touch: {
    width: 300,
    height: 40,
    backgroundColor: 'blue',
  },
});
